import csv
import datetime
import os
import re
import sys
import requests
import pprint
from pub_func import DownloadFile, folder_exist
from test1 import imr_url_list

cwd = os.getcwd()
sys.path.append(cwd)



def Download(img_url,img_name,img_file_path):
    folder_exist(img_file_path)
    # print(file_name)
    # print(radar_file_path)
    try:
        DownloadFile(img_url,img_file_path,img_name)
        print(img_file_path + '下载成功')
    except:
        print('下载失败',img_url)

if __name__ == '__main__':
    # for img_url in imr_url_list:
        # print(img_url)
        # img_name = str(img_url).split('/')[-1]
        # folder_name = str(img_url).split('/')[-2]
        # day_name = str(img_url.split('_')[-6])
        # file_type = str(img_url.split('/')[-3])
        # #http://smart2022-fdp.ium.cn/fdpverifygrid/wind/GRAPES-BLD/GRAPES-BLD_1KM_BTH_10UV_202101210000_03600060_022_BTH_uv10m_bias.png
        # path = '/media/ubuntu/08f29263-3882-43db-96fd-febb6f2e2e5f1/20210129/' + file_type + '/' + folder_name + '/'+ day_name+ '/'
        # Download(img_url,img_name,path)
    firstday_str = 202102010000
    list1 = [ '00' + str(i+1)for i in range(-1,24)]
    day_list = [ firstday_str + j*10000 for j in range(0,23)]
    hour_list = [ num[1:]  if len(num) == 4  else num for num in list1]
    print(day_list)
    print(hour_list)




######   tem ########

# NMCGRID_GMOSRR_url = '/fdpverifygrid/tem/NMCGRID-GMOSRR/NMCGRID-GMOSRR_1KM_OMA_2T_' + day_str + '_02400060_' + hour_str + '_OMA_t2m_bias.png'   #1-23



